{
  "swagger": "2.0",
  "info": {
    "title": "Data Structures API",
    "version": "",
    "description": "Following [Advanced Attributes](09.%20Advanced%20Attributes.md), this example demonstrates defining arbitrary data structure to be reused by various attribute descriptions.\n\nSince a portion of the `Coupon` data structure is shared between the `Coupon` definition itself and the `Create a Coupon` action, it was separated into a `Coupon Base` data structure in the `Data Structures` API Blueprint Section. Doing so enables us to reuse it as a base-type of other attribute definitions.\n\n## API Blueprint\n\n+ [Previous: Advanced Attributes](09.%20Advanced%20Attributes.md)\n\n+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/10.%20Data%20Structures.md)\n\n+ [Next: Resource Model](11.%20Resource%20Model.md)"
  },
  "paths": {
    "/coupons/{id}": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {},
            "examples": {
              "application/json": {
                "percent_off": 25,
                "redeem_by": 0,
                "id": "250FF",
                "created": 1415203908
              }
            },
            "schema": {
              "type": "object",
              "properties": {
                "percent_off": {
                  "type": "number",
                  "description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
                },
                "redeem_by": {
                  "type": "number",
                  "description": "Date after which the coupon can no longer be redeemed"
                },
                "id": {
                  "type": "string"
                },
                "created": {
                  "type": "number",
                  "description": "Time stamp"
                }
              }
            }
          }
        },
        "summary": "Retrieve a Coupon",
        "operationId": "Retrieve a Coupon",
        "description": "Retrieves the coupon with the given ID.",
        "tags": [
          "Coupons"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the desired coupon.",
            "required": true,
            "type": "string"
          }
        ],
        "produces": [
          "application/json"
        ],
        "consumes": []
      }
    },
    "/coupons": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {},
            "examples": {
              "application/json": [
                {
                  "percent_off": 25,
                  "redeem_by": 0,
                  "id": "250FF",
                  "created": 1415203908
                }
              ]
            },
            "schema": {
              "type": "array",
              "items": {}
            }
          }
        },
        "summary": "List all Coupons",
        "operationId": "List all Coupons",
        "description": "Returns a list of your coupons.",
        "tags": [
          "Coupons"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items.",
            "required": false,
            "type": "number",
            "default": 10
          }
        ],
        "produces": [
          "application/json"
        ],
        "consumes": []
      },
      "post": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {},
            "examples": {
              "application/json": {
                "percent_off": 25,
                "redeem_by": 0,
                "id": "250FF",
                "created": 1415203908
              }
            },
            "schema": {
              "type": "object",
              "properties": {
                "percent_off": {
                  "type": "number",
                  "description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
                },
                "redeem_by": {
                  "type": "number",
                  "description": "Date after which the coupon can no longer be redeemed"
                },
                "id": {
                  "type": "string"
                },
                "created": {
                  "type": "number",
                  "description": "Time stamp"
                }
              }
            }
          }
        },
        "summary": "Create a Coupon",
        "operationId": "Create a Coupon",
        "description": "Creates a new Coupon.",
        "tags": [
          "Coupons"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/Coupon Base"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "consumes": [
          "application/json"
        ]
      }
    }
  },
  "definitions": {
    "Coupon": {
      "allOf": [
        {
          "$ref": "#/definitions/Coupon Base"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "example": "250FF"
            },
            "created": {
              "type": "number",
              "example": 1415203908,
              "description": "Time stamp"
            }
          }
        }
      ]
    },
    "Coupons": {
      "type": "array",
      "items": {}
    },
    "Coupon Base": {
      "type": "object",
      "properties": {
        "percent_off": {
          "type": "number",
          "example": 25,
          "description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
        },
        "redeem_by": {
          "type": "number",
          "description": "Date after which the coupon can no longer be redeemed"
        }
      }
    }
  },
  "securityDefinitions": {},
  "tags": [
    {
      "name": "Coupons"
    }
  ]
}